﻿// JScript 文件
var list = new CtnListCtrl("list");
function init()
{
    var xmlInfo = '<items caption="新建工程列表" bcheck="1">'
        + '<colnames>'
            + '<ID0 visible="0">ID0</ID0>'
            + '<Bm bedit="0">编码</Bm>'
            + '<Mc>名称</Mc>'
            + '<group>建设单位</group>'
            + '<time>开工日期</time>'
            + '<time>俊工日期</time>'
        + '</colnames>'
        + '<item><ID0>10001</ID0><Bm>bm01</Bm><Mc>工程01</Mc><group>电信</group><time>2007-01</time><time>2008-01</time></item>'
        + '<item><ID0>10002</ID0><Bm>bm02</Bm><Mc>工程02</Mc><group>电信</group><time>2007-02</time><time>2008-01</time></item>'
        + '<item><ID0>10003</ID0><Bm>bm03</Bm><Mc>工程03</Mc><group>国土</group><time>2007-03</time><time>2008-01</time></item>'
        + '<item><ID0>10004</ID0><Bm>bm04</Bm><Mc>工程04</Mc><group>国土</group><time>2007-04</time><time>2008-01</time></item>'
        + '<item><ID0>10005</ID0><Bm>bm05</Bm><Mc>工程05</Mc><group>市政</group><time>2007-05</time><time>2008-01</time></item>'
        + '<item><ID0>10006</ID0><Bm>bm06</Bm><Mc>工程06</Mc><group>市政</group><time>2007-06</time><time>2008-01</time></item>'
        + '</items>';
    list.create("list");
    list.onGoPage = function (pageno)
    {
        this.reset();
        this.insertXml(xmlInfo, 1);
        for (var i = 0; i < list.arrRow.length; i++)
        {
            this.getCell(i, 1).text = '<a href="#" >' + this.getCell(i, 1).text + '</a>';//
        }
        this.show();
//        this.getRow(0).getCell("ID0").text;
    }
    list.goPage(1);
    $('func').innerHTML = '<input type="button" class="button" value="查看工程详细信息" onclick="impprj()"/> <input type="button" class="button" value="导入工程" onclick="impprj()"/>'
}

function impprj()
{
    CtnDlg.confirm("确定要导入这些工程?", impfinish);
}

function impfinish(flag)
{
    CtnDlg.msg("导入完成!");
    $("title").innerHTML="选择要拆分的工程(单选)";
    var xmlInfo = '<items caption="待拆分工程列表" bscheck="1">'
        + '<colnames>'
            + '<ID0 visible="0">ID0</ID0>'
            + '<Bm bedit="0">编码</Bm>'
            + '<Mc>名称</Mc>'
            + '<group>建设单位</group>'
            + '<time>开工日期</time>'
            + '<time>俊工日期</time>'
        + '</colnames>'
        + '<item><ID0>10001</ID0><Bm>bm01</Bm><Mc>工程01</Mc><group>电信</group><time>2007-01</time><time>2008-01</time></item>'
        + '<item><ID0>10002</ID0><Bm>bm02</Bm><Mc>工程02</Mc><group>电信</group><time>2007-02</time><time>2008-01</time></item>'
        + '<item><ID0>10003</ID0><Bm>bm03</Bm><Mc>工程03</Mc><group>国土</group><time>2007-03</time><time>2008-01</time></item>'
        + '<item><ID0>10004</ID0><Bm>bm04</Bm><Mc>工程04</Mc><group>国土</group><time>2007-04</time><time>2008-01</time></item>'
        + '<item><ID0>10005</ID0><Bm>bm05</Bm><Mc>工程05</Mc><group>市政</group><time>2007-05</time><time>2008-01</time></item>'
        + '<item><ID0>10006</ID0><Bm>bm06</Bm><Mc>工程06</Mc><group>市政</group><time>2007-06</time><time>2008-01</time></item>'
        + '</items>';
    list.create("list");
    list.onGoPage = function (pageno)
    {
        this.reset();
        this.insertXml(xmlInfo, 1);
        for (var i = 0; i < list.arrRow.length; i++)
        {
            this.getCell(i, 1).text = '<a href="#" >' + this.getCell(i, 1).text + '</a>';//
        }
        this.show();
//        this.getRow(0).getCell("ID0").text;
    }
    list.goPage(1);
    $('func').innerHTML = '<input type="button" class="button" value="查看工程详细信息" onclick="impprj()"/> <input type="button" class="button" value="下一步" onclick="seldj()"/> <input type="button" class="button" value="完成" onclick="selhbgg()"/>'
}
function seldj()
{
    $("title").innerHTML="请选择资产拆分类型";
    var xmlInfo = '<items caption="资产拆分类型列表" bcheck="1" bscheck="0">'
        + '<colnames>'
            + '<ID0 visible="0">ID0</ID0>'
            + '<Bm bedit="0">主类型</Bm>'
            + '<Mc>子类型</Mc>'
            + '<group>名称</group>'
        + '</colnames>'
        + '<item><ID0>10001</ID0><Bm>1</Bm><Mc>14</Mc><group>人手井</group></item>'
        + '<item><ID0>10002</ID0><Bm>1</Bm><Mc>16</Mc><group>电杆</group></item>'
        + '<item><ID0>10003</ID0><Bm>9</Bm><Mc>1</Mc><group>管孔</group></item>'
        + '<item><ID0>10004</ID0><Bm>1</Bm><Mc>26</Mc><group>交接箱</group></item>'
        + '<item><ID0>10005</ID0><Bm>1</Bm><Mc>28</Mc><group>分线盒</group></item>'
        + '<item><ID0>10006</ID0><Bm>1</Bm><Mc>46</Mc><group>IDF</group></item>'
        + '</items>';
    list.create("list");
    list.onGoPage = function (pageno)
    {
        this.reset();
        this.insertXml(xmlInfo, 1);
        for (var i = 0; i < list.arrRow.length; i++)
        {
            this.getCell(i, 1).text = '<a href="#" >' + this.getCell(i, 1).text + '</a>';//
        }
        this.show();
//        this.getRow(0).getCell("ID0").text;
    }
    list.goPage(1);
    $('func').innerHTML = '<input type="button" class="button" value="下一步(拆分)" onclick="cfprj()"/>'
}
function cfprj()
{
    CtnDlg.confirm("确定要进行拆分?", cfloading);
}
function cfloading()
{
    CtnDlg.loading("正在拆分人手井...", cffinish);
}
function cffinish()
{
    CtnDlg.unloading();
    CtnDlg.msg("拆分完成");
    $("title").innerHTML="拆分确认";
    var xmlInfo = '<items caption="子卡片列表"  bscheck="0"   bcheck="0">'
        + '<colnames>'
            + '<ID0 visible="0">ID0</ID0>'
            + '<Bm bedit="0">编码</Bm>'
            + '<Mc>资产名称</Mc>'
            + '<group>局站名称</group>'
            + '<time>规格程式</time>'
            + '<time>俊工日期</time>'
        + '</colnames>'
        + '<item><ID0>10001</ID0><Bm>bm01</Bm><Mc>人孔</Mc><group>神奇变色服饰门口</group><time>直通</time><time>2008-01</time></item>'
        + '<item><ID0>10002</ID0><Bm>bm02</Bm><Mc>人孔</Mc><group>精明眼镜店门口</group><time>直通</time><time>2008-01</time></item>'
        + '<item><ID0>10003</ID0><Bm>bm03</Bm><Mc>人孔</Mc><group>英豪数码婚纱摄影门口</group><time>末端</time><time>2008-01</time></item>'
        + '<item><ID0>10004</ID0><Bm>bm04</Bm><Mc>人孔</Mc><group>仙桃市林业局门口</group><time>三通</time><time>2008-01</time></item>'
        + '<item><ID0>10005</ID0><Bm>bm05</Bm><Mc>人孔</Mc><group>畜牧局右侧门口</group><time>三通</time><time>2008-01</time></item>'
        + '<item><ID0>10006</ID0><Bm>bm06</Bm><Mc>人孔</Mc><group>电力局左侧</group><time>末端</time><time>2008-01</time></item>'
        + '</items>';
    list.create("list");
    list.onGoPage = function (pageno)
    {
        this.reset();
        this.insertXml(xmlInfo, 1);
        for (var i = 0; i < list.arrRow.length; i++)
        {
            this.getCell(i, 1).text = '<a href="#" >' + this.getCell(i, 1).text + '</a>';//
        }
        this.show();
//        this.getRow(0).getCell("ID0").text;
    }
    list.goPage(1);
    $('func').innerHTML = '<input type="button" class="button" value="导出列表" onclick="impprj()"/><input type="button" class="button" value="回退" onclick="impprj()"/> <input type="button" class="button" value="下一步(确认)" onclick="selhbgg()"/> <input type="button" class="button" value="完成(确认)" onclick="selhbgg()"/>'
}

function selhbgg()
{
    $("title").innerHTML="请选择合并类型";
    var xmlInfo = '<items caption="资产合并类型列表" bcheck="1" bscheck="0">'
        + '<colnames>'
            + '<ID0 visible="0">ID0</ID0>'
            + '<Bm bedit="0">主类型</Bm>'
            + '<Mc>子类型</Mc>'
            + '<group>名称</group>'
        + '</colnames>'
        + '<item><ID0>10001</ID0><Bm>1</Bm><Mc>14</Mc><group>人手井</group></item>'
        + '<item><ID0>10002</ID0><Bm>1</Bm><Mc>16</Mc><group>电杆</group></item>'
        + '<item><ID0>10003</ID0><Bm>9</Bm><Mc>1</Mc><group>管孔</group></item>'
        + '<item><ID0>10004</ID0><Bm>1</Bm><Mc>26</Mc><group>交接箱</group></item>'
        + '<item><ID0>10005</ID0><Bm>1</Bm><Mc>28</Mc><group>分线盒</group></item>'
        + '<item><ID0>10006</ID0><Bm>1</Bm><Mc>46</Mc><group>IDF</group></item>'
        + '</items>';
    list.create("list");
    list.onGoPage = function (pageno)
    {
        this.reset();
        this.insertXml(xmlInfo, 1);
        for (var i = 0; i < list.arrRow.length; i++)
        {
            this.getCell(i, 1).text = '<a href="#" >' + this.getCell(i, 1).text + '</a>';//
        }
        this.show();
//        this.getRow(0).getCell("ID0").text;
    }
    list.goPage(1);
    $('func').innerHTML = '<input type="button" class="button" value="下一步(合并)" onclick="hbprj()"/>'
}

function hbprj()
{
    CtnDlg.confirm("确定要进行合并?", hbloading);
}

function hbloading()
{
    CtnDlg.loading("正在合并人手井...", hbfinish);
}

function hbfinish()
{
    CtnDlg.unloading();
    CtnDlg.msg("合并完成");
    $("title").innerHTML="合并确认";
    var xmlInfo = '<items caption="卡片信息列表"  bscheck="0" bcheck="0">'
        + '<colnames>'
            + '<ID0 visible="0">ID0</ID0>'
            + '<Bm bedit="0">编码</Bm>'
            + '<Mc>资产名称</Mc>'
            + '<group>局站名称</group>'
            + '<time>规格程式</time>'
            + '<time>俊工日期</time>'
        + '</colnames>'
        + '<item><ID0>10001</ID0><Bm>bm01</Bm><Mc>人孔</Mc><group>神奇变色服饰门口</group><time>直通</time><time>2008-01</time></item>'
        + '<item><ID0>10002</ID0><Bm>bm02</Bm><Mc>人孔</Mc><group>精明眼镜店门口</group><time>直通</time><time>2008-01</time></item>'
        + '<item><ID0>10003</ID0><Bm>bm03</Bm><Mc>人孔</Mc><group>英豪数码婚纱摄影门口</group><time>末端</time><time>2008-01</time></item>'
        + '<item><ID0>10004</ID0><Bm>bm04</Bm><Mc>人孔</Mc><group>仙桃市林业局门口</group><time>三通</time><time>2008-01</time></item>'
        + '<item><ID0>10005</ID0><Bm>bm05</Bm><Mc>人孔</Mc><group>畜牧局右侧门口</group><time>三通</time><time>2008-01</time></item>'
        + '<item><ID0>10006</ID0><Bm>bm06</Bm><Mc>人孔</Mc><group>电力局左侧</group><time>末端</time><time>2008-01</time></item>'
        + '</items>';
    list.create("list");
    list.onGoPage = function (pageno)
    {
        this.reset();
        this.insertXml(xmlInfo, 1);
        for (var i = 0; i < list.arrRow.length; i++)
        {
            this.getCell(i, 1).text = '<a href="#" >' + this.getCell(i, 1).text + '</a>';//
        }
        this.show();
//        this.getRow(0).getCell("ID0").text;
    }
    list.goPage(1);
    $('func').innerHTML = '<input type="button" class="button" value="导出列表" onclick="impprj()"/> <input type="button" class="button" value="回退" onclick="impprj()"/><input type="button" class="button" value="确认(完成)" onclick="finish()"/>'
}

function finish()
{
    var objWnd = top.m_doc.getWndObj(m_vt.SYS_MAIN);
    if (objWnd)
    {
        var tool = {};
        Object.extend(tool, objWnd.tool);
        tool.url = tool.url.split("?")[0] + "?" + new Date().getTime();
        objWnd.update(tool);
        top.m_doc.removeWnd(m_vt.ASS_MAIN);
        top.m_doc.setActive(tool.id);
    }
}
